import wxRequest from '@utils/wxRequest'
import config from '~/config/index'
let request = new wxRequest({
  baseUrl: config.baseURL,
  loginUrl: '/Account/Code/Login',
  logOff: '/Account/User/LogoutUser',
  resolveData: function (data: any) {
    return data.data
  },
  getToken: function (data: any) {
    return data.data.access_token
  },
  reqSuccess: function (data: any) {
    if (data && data.code === 0) {
      return true
    }
    return false
  },
  reacquire: function (data: any) {
    if (data && [401, 402].includes(data.code)) {
      return true
    }
    return false
  }
})

export default request
